<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="./js/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
   <!-- <div id="temp" style="display: none;">
     
        <table id="temp_table">
            <tr id="temp_tr">
            	<td  id="link_id" style="display: none"></td>
                <td id="name" width="16%" height="25" align="center" bgcolor="#EFFBFE" ></td>
                <td id="sex" align="center" bgcolor="#EFFBFE"  width="6%"></td>
                <td id="position" align="center" bgcolor="#EFFBFE" style="width: 18%"></td>
                <td id="phone" align="center" bgcolor="#EFFBFE" style="width: 16%"></td>
                <td id="email" align="center" bgcolor="#EFFBFE" style="width: 22%"></td>
                <td id="edit" align="left" bgcolor="#EFFBFE" style="width: 22%">
                    <div align="left" >
                            <div class="layui-btn-group" align="center">
					           <button class="layui-btn"  id="bj" name="edit" onclick="editLink(this.value)">编辑</button>
					           <button class="layui-btn layui-btn-danger" id="sc" name="delete" onclick="delLink()">删除</button>
					         </div>
                    </div>
                </td>
            </tr>
        </table>
	</div> -->

     <div class="x-body">
    <button class="layui-btn layui-btn-normal" onclick="addLink()"><i class="layui-icon">&#xe608;</i>添加联系人</button>
        <form class="layui-form">
           <table class="layui-table" >
              <colgroup>
                 <col width="16%">
                 <col width="6%">
                 <col width="18%">
                 <col width="16%">
                 <col  width="22%">
                 <col width="22%"> 
             </colgroup>
           <thead>
             <tr>
              <th>姓名</th>
              <th>性别</th>
              <th>职务</th>
              <th>电话</th>
              <th>邮箱</th>
              <th>编辑</th>
			</thead>
			<tbody id="is_header" clas>
				<tr>
        <td>贤心</td>
        <td>女</td>
        <td>老师</td>
        <td>132523242</td>
        <td>132523242@163.com</td>
        <td>
          <div class="layui-btn-group">
           <button class="layui-btn" style="margin-right:20px !important" onclick="editLink()">编辑</button>
           <button class="layui-btn layui-btn-danger">删除</button>
          </div>
          </td>
    </tr>
			</tbody>
      </form>
    </div>
    
    
    <script>
        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer;
        
          //自定义验证规则
          form.verify({
            nikename: function(value){
              if(value.length < 5){
                return '昵称至少得5个字符啊';
              }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
          });

          //监听提交
          form.on('submit(add)', function(data){
            console.log(data);
            //发异步，把数据提交给
            var num = location.search.substring(1);
        	var comp_id =  num.substring(8);
        	  
            var formdata = $("#formId").serialize();
            $.post("productLink_save?"+formdata+"&company.comp_id="+comp_id,function(){
            	
            });
            
            layer.alert("增加成功", {icon: 6},function () {
                // 获得frame索引
                var index = parent.layer.getFrameIndex(window.name);
                //关闭当前frame
                parent.layer.close(index);
            });
            return false;
          });
          
          
        });
        
      //获取公司id
    	var cate_id =  window.location.search.substring(1).substring(8);
    	
      //联系人加载
  	  $.post("productLink_findAll?comp_id="+cate_id,function(data){
   		 $.each(data,function(i,n){
   			/*  $("#temp_table #temp_tr #name").text(n.link_name);
   			 $("#temp_table #temp_tr #sex").text(n.link_sex==1?'男':'女');
   			 $("#temp_table #temp_tr #position").text(n.link_position);
   			 $("#temp_table #temp_tr #phone").text(n.link_phone);
   			 $("#temp_table #temp_tr #email").text(n.link_email);
   			 
   			$("#temp_table #temp_tr #edit #bj").val(n.link_id);
   			$("#temp_table #temp_tr #edit #sc").val(n.link_id);
   			$("#temp_table #temp_tr").clone(true).insertAfter("#is_header"); */
   		 });
   	 });
      
  	function addLink(){
  		var cate_id =  window.location.search.substring(1).substring(8);
  		window.location.href="customer-add.html?comp_id="+cate_id;
  	}
  	
  	function delLink(){
  		
  	}
  	
  	function editLink(data){
  		console.log("开始");
  		x_admin_show("kjkk",'1.jsp');
  		console.log("结束");
  	}
    </script>
  </body>

</html>